const {
  userDesc_mock,
} = require("../../../mock/user.js")
const {
  iocnList1_mock,
  iocnList2_mock,
  iocnList3_mock
} = require("../../../mock/user_icon.js")
const {
  baseUrl,
  getRequest,
  postRequest
} = require("../../../utils/request.js")
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //用户详情
    userDesc: '',
    //图标列表
    iocnList1: '',
    iocnList2: '',
    iocnList3: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.http_user_findById()
    this.setData({
      //userDesc: userDesc_mock,
      iocnList1: iocnList1_mock,
      iocnList2: iocnList2_mock,
      iocnList3: iocnList3_mock
    })
  },
  /**
   * 跳转到对应页面
   */
  onPage(e) {
    wx.navigateTo({
      url: e.currentTarget.dataset.url,
    })
  },
  /**
   * 跳转用户详情页面
   */
  onUserDescPage(e) {
    wx.navigateTo({
      url: '/pages/user/desc/desc'
    })
  },
  /**
   * 客服热线动作面板
   */
  handleKeFuAction() {
    this.setData({
      show: true
    });
  },
  onKeFuClose() {
    this.setData({
      show: false
    });
  },
  onKeFuSelect(event) {
    console.log(event.detail);
  },
  /**
   * 查询用户详情
   */
  http_user_findById() {
    wx.getStorage({
      key: "userId",
      success: res => {
        //console.log(res.data)
        getRequest(baseUrl + "/front/user/findById", {
          userId: res.data
        }).then(res => {
          //console.log(res.data)
          if (res.code == 200) {
            this.setData({
              userDesc: res.data
            })
          }
        })
      }
    })
  }
})